home *** CD-ROM | disk | FTP | other *** search
- 1 goto28
- 2 pokem,77:pokem+3,78:pokem+23,77:pokem+24,78:pokem+45,78
- 3 pokem+46,77:pokem+66,78:pokem+69,77:return
- 4 pokem,85:pokem+1,67:pokem+2,67:pokem+3,73:pokem+22,66:pokem+23,32:pokem+25,93
- 5 pokem+44,66:pokem+47,93:pokem+66,74:pokem+67,64:pokem+68,64:pokem+69,75:return
- 6 fori=m+c tom+c+66 step22:pokei,cc(n):pokei+1,cc(n):pokei+2,cc(n)
- 7 pokei+3,cc(n):next:return
- 8 pokef1,231
- 9 ford=1to60:next:pokef1,0:return
- 10 x=n:p(e)=x:m=s(e):onx gosub2,2,4
- 11 gosub6
- 12 fori=1to7step3
- 13 ifp(i)<>p(i+1)then16
- 14 ifp(i)<>p(i+2)then16
- 15 onp(i)+1goto16,89,89,89
- 16 next
- 17 fori=1to3
- 18 ifp(i)<>p(i+3)then21
- 19 ifp(i)<>p(i+6)then21
- 20 onp(i)+1goto21,89,89,89
- 21 next
- 22 ifp(5)<>x then25
- 23 if(p(1)=x)and(p(9)=x)then89
- 24 if(p(3)=x)and(p(7)=x)then89
- 25 fori=1to9:ifp(i)=0then27
- 26 next:print"tie game!":goto92
- 27 n=abs(n-4):return
- 28 print"[147]":printtab(5)"tic-tac-toe":fori=1to9:reads(i):next
- 29 data7726,7733,7740,7880,7887,7894,8034,8041,8048
- 30 print"choose one of the":print"position numbers.":print"get 3 in a row."
- 31 poke36878,15:f1=36876:c=30720:cc(1)=6:cc(3)=2:y=3:z=1:h=2
- 32 print"[144]x gets first move.":print"choose [144]f1 for [144]x":printtab(7)"f3 for [144]0"
- 33 gete$:ife$<>"[133]"ande$<>"[134]"then33
- 34 ife$="[133]"theny=1:z=3
- 35 print"choose [144]f1 beginner":printtab(7)"[144]f3 intermediate"
- 36 gete$:ife$<>"[133]"ande$<>"[134]"then36
- 37 ife$="[133]"thenh=1
- 38 print"[147]":t=int(6*rnd(0))+2:fori=1to9:p(i)=0:next
- 39 fori=7709to8129step22:pokei,160:pokei+c,t:pokei+7,160:pokei+7+c,t:next
- 40 fori=7835to7854:pokei,160:pokei+c,t:pokei+154,160:pokei+154+c,t:next
- 41 fori=1to9:pokes(i)+23,i+48:pokes(i)+23+c,0:next
- 42 n=1:ifh=2then51
- 43 ify=1then46
- 44 e=int(9*rnd(0)+1):ifp(e)<>0then44
- 45 gosub10
- 46 gosub8
- 47 gete$:ife$=""then47
- 48 ife$<"1"ore$>"9"then47
- 49 e=val(e$):ifp(e)<>0then46
- 50 gosub10:onh goto44,52
- 51 ify=1then46
- 52 ifp(5)=0thene=5:goto88
- 53 ifp(5)=x then58
- 54 ifp(1)=0andp(9)=z thene=1:goto88
- 55 ifp(1)=z andp(9)=0thene=9:goto88
- 56 ifp(3)=0andp(7)=z thene=3:goto88
- 57 ifp(3)=z andp(7)=0thene=7:goto88
- 58 fork=1to3:if(p(k)=x)+(p(k+3)=x)+(p(k+6)=x)then63
- 59 ifp(k)+p(k+3)+p(k+6)<>2*z then63
- 60 if p(k)=0thene=k:goto88
- 61 ifp(k+3)=0thene=k+3:goto88
- 62 e=k+6:goto88
- 63 next
- 64 fork=1to7step3:if(p(k)=x)+(p(k+1)=x)+(p(k+2)=x)then69
- 65 ifp(k)+p(k+1)+p(k+2)<>2*z then69
- 66 ifp(k)=0thene=k:goto88
- 67 ifp(k+1)=0thene=k+1:goto88
- 68 e=k+2:goto88
- 69 next
- 70 fork=1to3:if(p(k)=z)+(p(k+3)=z)+(p(k+6)=z)then75
- 71 ifp(k)+p(k+3)+p(k+6)<>2*x then75
- 72 ifp(k)=0thene=k:goto88
- 73 ifp(k+3)=0thene=k+3:goto88
- 74 e=k+6:goto88
- 75 next
- 76 fork=1to7step3:if(p(k)=z)+(p(k+1)=z)+(p(k+2)=z)then81
- 77 ifp(k)+p(k+1)+p(k+2)<>2*x then81
- 78 ifp(k)=0then e=k:goto88
- 79 ifp(k+1)=0thene=k+1:goto88
- 80 e=k+2:goto88
- 81 next
- 82 ifp(5)=z then87
- 83 ifp(1)=0andp(9)=x thene=1:goto88
- 84 ifp(1)=x andp(9)=0thene=9:goto88
- 85 ifp(3)=0andp(7)=x thene=3:goto88
- 86 ifp(3)=x andp(7)=0thene=7:goto88
- 87 goto44
- 88 gosub10:goto46
- 89 ifx<>y then91
- 90 print"you win!!!":goto92
- 91 print"computer wins!!"
- 92 fori=1to20:pokef1,int(20*rnd(0)+200):gosub9:next
- 93 print"try again? (y/n)";
- 94 gete$:ife$="n"then97
- 95 ife$<>"y"then94
- 96 clr:goto28
- 97 print"[147]":end
-